package pausing;

import java.util.*;

import scheduler.Scheduler;

public class Pauser {
	private static List<Pauseable> needToPause = new ArrayList<Pauseable>();
	
	public static void addPauseable(Pauseable toAdd) {
		needToPause.add(toAdd);
	}
	
	public static void toPauseOrNot2Pause() {
		Scheduler.getInstance().pause();
		for (Pauseable p : needToPause) {
			p.togglePauseFlag();
		}
	}
	
	public static void pause() {
		Scheduler.getInstance().pause();
		for (Pauseable p : needToPause) {
			p.setPauseFlag(true);
		}
	}
	
	public static void resume() {
		Scheduler.getInstance().resume();
		for (Pauseable p : needToPause) {
			p.setPauseFlag(false);
		}
	}
}
